package Date;

import java.util.Calendar;

/**
 * @Author wangzhipeng
 * @Date 2020-08-10 7:58 下午
 * @Description
 */
public class Time1 {
    public static void main(String[] args) {
        //上个月的第一天是周几
//        Calendar calendar = Calendar.getInstance();
//        calendar.add(Calendar.MONTH,-1);//上个月
//        calendar.set(Calendar.DATE,1);//周一
//        int dayOfWeek = calendar.get(Calendar.DAY_OF_MONTH)-1;//从周天开始
//        System.out.println("上个月第一天是周"+dayOfWeek);


        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.MONTH,1);
        int monthDaysSum = calendar.getActualMaximum(Calendar.DATE);
        calendar.set(Calendar.DATE,monthDaysSum);
        int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK)-1;//从周天开始
        System.out.println("下个月最后一天是周"+dayOfWeek);



    }
}
